package com.appoint.web.controller.buss;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.appoint.common.annotation.Anonymous;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.appoint.common.annotation.Log;
import com.appoint.common.core.controller.BaseController;
import com.appoint.common.core.domain.AjaxResult;
import com.appoint.common.enums.BusinessType;
import com.appoint.buss.domain.EpiparaSpeciesFactors;
import com.appoint.buss.service.IEpiparaSpeciesFactorsService;
import com.appoint.common.utils.poi.ExcelUtil;
import com.appoint.common.core.page.TableDataInfo;

/**
 * overall-infoController
 *
 * @author appoint
 * @date 2023-01-08
 */
@RestController
@RequestMapping("/buss/factors")
public class EpiparaSpeciesFactorsController extends BaseController
{
    @Autowired
    private IEpiparaSpeciesFactorsService epiparaSpeciesFactorsService;

    /**
     * 查询overall-info列表
     */
    @PreAuthorize("@ss.hasPermi('buss:factors:list')")
    @GetMapping("/list")
    public TableDataInfo list(EpiparaSpeciesFactors epiparaSpeciesFactors)
    {
        startPage();
        List<EpiparaSpeciesFactors> list = epiparaSpeciesFactorsService.selectEpiparaSpeciesFactorsList(epiparaSpeciesFactors);
        return getDataTable(list);
    }

    /**
     * 导出overall-info列表
     */
    @PreAuthorize("@ss.hasPermi('buss:factors:export')")
    @Log(title = "overall-info", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EpiparaSpeciesFactors epiparaSpeciesFactors)
    {
        List<EpiparaSpeciesFactors> list = epiparaSpeciesFactorsService.selectEpiparaSpeciesFactorsList(epiparaSpeciesFactors);
        ExcelUtil<EpiparaSpeciesFactors> util = new ExcelUtil<EpiparaSpeciesFactors>(EpiparaSpeciesFactors.class);
        util.exportExcel(response, list, "overall-info数据");
    }

    /**
     * 获取overall-info详细信息
     */
    @PreAuthorize("@ss.hasPermi('buss:factors:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(epiparaSpeciesFactorsService.selectEpiparaSpeciesFactorsById(id));
    }

    /**
     * 新增overall-info
     */
    @PreAuthorize("@ss.hasPermi('buss:factors:add')")
    @Log(title = "overall-info", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EpiparaSpeciesFactors epiparaSpeciesFactors)
    {
        return toAjax(epiparaSpeciesFactorsService.insertEpiparaSpeciesFactors(epiparaSpeciesFactors));
    }

    /**
     * 修改overall-info
     */
    @PreAuthorize("@ss.hasPermi('buss:factors:edit')")
    @Log(title = "overall-info", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EpiparaSpeciesFactors epiparaSpeciesFactors)
    {
        return toAjax(epiparaSpeciesFactorsService.updateEpiparaSpeciesFactors(epiparaSpeciesFactors));
    }

    /**
     * 删除overall-info
     */
    @PreAuthorize("@ss.hasPermi('buss:factors:remove')")
    @Log(title = "overall-info", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(epiparaSpeciesFactorsService.deleteEpiparaSpeciesFactorsByIds(ids));
    }

    /**
     * 查询overall-info列表
     */
    @Anonymous
    @GetMapping("/list2")
    public TableDataInfo list2(EpiparaSpeciesFactors epiparaSpeciesFactors)
    {
        startPage();
        List<EpiparaSpeciesFactors> list = epiparaSpeciesFactorsService.selectEpiparaSpeciesFactorsList(epiparaSpeciesFactors);
        return getDataTable(list);
    }
    /**
     * 查询species列表
     */
    @Anonymous
    @GetMapping("/species")
    public  AjaxResult species(EpiparaSpeciesFactors epiparaSpeciesFactors)
    {
        return AjaxResult.success(epiparaSpeciesFactorsService.species(epiparaSpeciesFactors));
    }

    /**
     * 查询biologicalSources列表
     */
    @Anonymous
    @GetMapping("/biologicalSources")
    public AjaxResult biologicalSources(EpiparaSpeciesFactors epiparaSpeciesFactors)
    {
        return AjaxResult.success(epiparaSpeciesFactorsService.biologicalSources(epiparaSpeciesFactors));
    }

    /**
     * 查询factors列表
     */
    @Anonymous
    @GetMapping("/factors")
    public AjaxResult factors(EpiparaSpeciesFactors epiparaSpeciesFactors)
    {
        return AjaxResult.success(epiparaSpeciesFactorsService.factors(epiparaSpeciesFactors));
    }
}
